package com.home.java;

public class Count {
    public long sum(int... nums) {
        long sum = 0;
        for (int i = 0; i < nums.length; i++) {
            sum += nums[i];

        }
        return sum;
    }

//public int max(int a, int... others)：求1~n个整数中的最大值

    public int max(int a, int... others) {
        int max = a;
        for (int i = 0; i < others.length; i++) {
            if (max < others[i]) {
                max = others[i];
            }
        }
        return max;
    }

    //public String concat(String...  strings)：求0~n个字符串的拼接结果
    public String concat(String... strings) {
        String result = "";
        for (int i = 0; i < strings.length; i++) {
            result += strings[i];
        }
        return result;
    }

    //判断0~n个整数是否都是偶数，如果都是偶数，返回true，否则返回false
    public boolean isEven(int... nums) {
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] % 2 != 0) {
                return false;
            }
        }
        return true;
    }
}






